package com.example.sso.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.sso.server.dao.SysPermissionDao;
import com.example.sso.server.entity.SysPermission;
import com.yky.service.sys.SysPermissionService;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * (SysPermission)表服务实现类
 *
 * @author makejava
 * @since 2024-02-21 09:56:57
 */
@Service("sysPermissionService")
public class SysPermissionServiceImpl implements SysPermissionService {
    @Resource
    private SysPermissionDao sysPermissionDao;
    @Override
    public List<String> getAccountPermissionList(String accountId) {
        List<String> result = new ArrayList<>();
        List<SysPermission> list = sysPermissionDao.listByAccountId(accountId);
        if (list == null || list.isEmpty()){
            return result;
        }
        return list.stream().map(SysPermission::getPermissionUrl).distinct().collect(Collectors.toList());
    }
}

